// 结算重构-2.0 接口
import request from '@/utils/request' // 引入封装的axios
import { commonBaseUrl } from '@/utils' // 引入封装的axios
const moduleName = commonBaseUrl('B') // 引入封装的axios

// 物资获取绑定信息接口 queryProductBinding
export function getProductBinding(prjId) {
    return request({
        url: moduleName + 'api/material_adjust/queryProductBindingInfos',
        params: { prjId },
        showLoading: true
    })
}
// 物资绑定-子专业获取列表 bundingId , materialCode
export function getSubProductList(bundingId, materialCode) {
    return request({
        url: moduleName + 'api/material_adjust/queryTMaterialCodeOthersSubSpec',
        params: { bundingId, materialCode },
        showLoading: true
    })
}
// 物资绑定-子专业保存物资绑定结果
export function saveProductBinding(data) {
    return request({
        url: moduleName + 'api/material_adjust/saveSubSpecBundingDetail',
        method: 'post',
        data,
        showLoading: true
    })
}
// 结算调整-【结算确认】建设子专业确定绑定结果prjId
export function confirmProductBinding(prjId) {
    return request({
        url: moduleName + `api/material_adjust/updateSubSpecStatus?prjId=${prjId}`,
        method: 'post',
        showLoading: true
    })
}
// 获取物资调整明细
export function getMaterialDetails(adjustId) {
    return request({
        url: moduleName + 'api/material_adjust/getMaterialAdjustInfo',
        params: { adjustId },
        showLoading: true
    })
}
// 获取物资编码
export function getMaterialCode() {
    return request({
        url: moduleName + 'api/material_adjust/getQuantitiesCode'
    })
}
// 单站批量项目校验 prjId ,taskId
export function projectVerification(params) {
    return request({
        url: moduleName + 'api/material_adjust/checkSingleBatchProject',
        params,
        showLoading: true
    })
}
//  校验绑定设备 prjId ,checkType
export function verifBoundDevices(params) {
    return request({
        url: moduleName + 'api/material_adjust/checkBindingEquip',
        params,
        showLoading: true
    })
}
// 获取项目信息  prjId
export function getProjectDetails(prjId) {
    return request({
        url: moduleName + 'api/settle_project/getProjectInfo',
        params: { prjId },
        showLoading: true
    })
}
// 查询项目是否送审 prjId
export function queryEnsorship(prjId) {
    return request({
        url: moduleName + 'api/settle_project/queryProjectPushStatus',
        params: { prjId },
        showLoading: true
    })
}
// 【保存明细】物资信息保存接口
export function updateEquips(data) {
    return request({
        url: moduleName + 'api/material_adjust/updateEquips',
        method: 'post',
        data,
        showLoading: true
    })
}
// 物资结算-总接口
export function saveMaterialAdjust(prjId, processId, adjustId) {
    return request({
        url: moduleName + `api/material_adjust/viewDetailsBefore?prjId=${prjId}&processId=${processId}&adjustId=${adjustId}`,
        showLoading: true,
        hideMessage: true // 隐藏消息提示
    })
}

// 获取服务明细接口 15400495
export function getServicesdetails(adjustId) {
    return request({
        url: moduleName + 'api/server_adjust/queryQuantitiesServList',
        params: { adjustId },
        method: 'post',
        showLoading: true
    })
}
// 物服务明细保存接口
export function updateServicesEquips(data, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/updateQuantitiesServ?processInstId=${processInstId}`,
        method: 'post',
        data,
        showLoading: true
    })
}

// 结算调整-服务 退回供应商接口
export function backSuppliers(data, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/backSuppliers?processInstId=${processInstId}`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 结算调整-服务 推送供应商接口 adjustId、prjId、processInstId
export function upPushSuppliers(adjustId, prjId, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/pushSuppliers?adjustId=${adjustId}&prjId=${prjId}&processInstId=${processInstId}`,
        method: 'post',
        showLoading: true
    })
}
// 结算调整-服务  取消更新采购订单 prjId，adjustId，processInstId
export function cancelUpdateOrder(data) {
    return request({
        url: moduleName + `api/server_adjust/cancelPurchaseOrder`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 结算调整-推送服务  推送商合 prjId,adjustId,adjustType,processInstId
export function pushServerCooperation(prjId, adjustId, adjustType, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/sentServSh?prjId=${prjId}&adjustId=${adjustId}&adjustType=${adjustType}&processInstId=${processInstId}`,
        method: 'post',
        showLoading: true
    })
}
// 结算调整-推送物资  推送商合 prjId,adjustId,processInstId
export function pushMateriaCooperation(prjId, adjustId, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/sentEquipSh?prjId=${prjId}&adjustId=${adjustId}&processInstId=${processInstId}`,
        method: 'post',
        showLoading: true
    })
}

// 结算调整-服务-供应商确认列表 adjustId、serviceCode、serviceUserId
export function supplierConfirmList(data) {
    return request({
        url: moduleName + `api/server_adjust/querySupplierConfirmServList`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 结算调整-服务-【供应商调整保存】
export function supplierSaveList(data) {
    return request({
        url: moduleName + `api/server_adjust/querySupplierConfirmServList`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 结算调整-服务-【供应商调整确认】 adjustId、serviceCode、serviceUserId
export function supplierUpdateConfirm(data) {
    return request({
        url: moduleName + `api/server_adjust/updateConfirmServ`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 结算调整-结算流程【下一步、转派、退回】 prjId、adjustId、processInstId
export function settlementProcess(data) {
    return request({
        url: moduleName + `api/settle_flow/doSettNext`,
        method: 'post',
        data,
        showLoading: true
    })
}

// 获取服务商下拉框接口 prjId
export function getSelectSupper(prjId) {
    return request({
        url: moduleName + `api/server_adjust/queryServiceList?prjId=${prjId}`,
        method: 'post'
    })
}
// 获取人员下拉框接口prjId，serviceCode
export function getSelectUsers(prjId, serviceCode) {
    return request({
        url: moduleName + `api/server_adjust/queryServiceUserList?prjId=${prjId}&serviceCode=${serviceCode}`,
        method: 'post'
    })
}

// 供应商确认代办接口  需要拿到三个id
export function getSuppierConfirmInfo(confirmId) {
    return request({
        url: moduleName + `api/server_adjust/queryServConfirmInfo?confirmId=${confirmId}`,
        method: 'post',
        showLoading: true
    })
}

// 获取供应商确认列表
export function getSuppierConfirmServList(adjustId, serviceCode, serviceUserId) {
    return request({
        url: moduleName + `api/server_adjust/querySupplierConfirmServList?adjustId=${adjustId}&serviceCode=${serviceCode}&serviceUserId=${serviceUserId}`,
        method: 'post',
        showLoading: true
    })
}
// 供应商保存接口 更新
export function updateSuppierSaveInfo(data, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/updateSupplierServ?processInstId=${processInstId}`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 供应商供应商调整确认
export function getSuppierConfirm(adjustId, serviceCode, serviceUserId, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/updateConfirmServ?adjustId=${adjustId}&serviceCode=${serviceCode}&serviceUserId=${serviceUserId}&processInstId=${processInstId}`,
        method: 'post',
        showLoading: true
    })
}

// 更新商合采购订单按钮逻辑 prjId,adjustId,queryType,processInstId
export function updateBusinessOrder(prjId, adjustId, queryType, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/updatePurchaseOrder?prjId=${prjId}&adjustId=${adjustId}&queryType=${queryType}&processInstId=${processInstId}`,
        method: 'post',
        showLoading: true
    })
}
// 取消更新商合采购订单按钮逻辑
export function cancelUpdateBusinessOrder(prjId, adjustId, processInstId) {
    return request({
        url: moduleName + `api/server_adjust/cancelPurchaseOrder?prjId=${prjId}&adjustId=${adjustId}&processInstId=${processInstId}`,
        method: 'post',
        showLoading: true
    })
}

// 获取结算调整基本信息
export function getBalanceBasicDetails(adjustId) {
    return request({
        url: moduleName + `api/settle_project/queryQuantityAdjInfo?adjustId=${adjustId}`,
        method: 'post',
        showLoading: true
    })
}

// 下一步回退之前的校验
export function getNextBackVerfiation(data) {
    return request({
        url: moduleName + `api/settle_flow/doNextCheck`,
        method: 'post',
        data,
        showLoading: true
    })
}
// 获取adjustid
export function getOnlyId(prjId) {
    return request({
        url: moduleName + `api/settle_project/queryAdjustInfo?prjId=${prjId}`,
        method: 'post',
        showLoading: true
    })
}

// 下一步强弱校验
export function nextStrengthCheck(data) {
    return request({
        url: moduleName + `api/settle_flow/checkInvestMoney`,
        method: 'post',
        data,
        showLoading: true
    })
}

